
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>分享 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="pay.html" />
    
    
    <link rel="prev" href="media.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../introduction/environment.html">
            
                <a href="../introduction/environment.html">
            
                    
                    环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../introduction/hello.html">
            
                <a href="../introduction/hello.html">
            
                    
                    HelloWorld
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../introduction/dev-and-debug.html">
            
                <a href="../introduction/dev-and-debug.html">
            
                    
                    开发与调试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../framework/file.html">
            
                <a href="../framework/file.html">
            
                    
                    文件组织
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../framework/manifest.html">
            
                <a href="../framework/manifest.html">
            
                    
                    manifest文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../framework/nml.html">
            
                <a href="../framework/nml.html">
            
                    
                    nml文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../framework/page.html">
            
                <a href="../framework/page.html">
            
                    
                    页面与组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../component/general.html">
            
                <a href="../component/general.html">
            
                    
                    通用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../component/container.html">
            
                <a href="../component/container.html">
            
                    
                    容器组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../component/basics.html">
            
                <a href="../component/basics.html">
            
                    
                    基础组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../component/form.html">
            
                <a href="../component/form.html">
            
                    
                    表单组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../component/media.html">
            
                <a href="../component/media.html">
            
                    
                    媒体组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    接口
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="general.html">
            
                <a href="general.html">
            
                    
                    通用规则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="basic.html">
            
                <a href="basic.html">
            
                    
                    基本功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="interface.html">
            
                <a href="interface.html">
            
                    
                    界面交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="request.html">
            
                <a href="request.html">
            
                    
                    网络访问
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="storage.html">
            
                <a href="storage.html">
            
                    
                    文件数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="system.html">
            
                <a href="system.html">
            
                    
                    系统能力
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="media.html">
            
                <a href="media.html">
            
                    
                    图形图像
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.8" data-path="share.html">
            
                <a href="share.html">
            
                    
                    分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="pay.html">
            
                <a href="pay.html">
            
                    
                    支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="stat.html">
            
                <a href="stat.html">
            
                    
                    统计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >分享</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x7B2C;&#x4E09;&#x65B9;&#x5206;&#x4EAB;">&#x7B2C;&#x4E09;&#x65B9;&#x5206;&#x4EAB;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;-29">&#x63A5;&#x53E3;&#x58F0;&#x660E; </h4>
<p>{&quot;name&quot;: &quot;service.share&quot;}</p>
<h4 id="unisharegetproviderobject">uni.share.getProvider(OBJECT)</h4>
<p>&#x83B7;&#x53D6;&#x670D;&#x52A1;&#x63D0;&#x4F9B;&#x5546;&#xFF0C;&#x5982;&#x5382;&#x5546;&#x7684;&#x82F1;&#x6587;&#x54C1;&#x724C;&#x540D;&#x79F0;&#xFF0C;&#x5047;&#x5982;&#x65E0;&#x6B64;&#x670D;&#x52A1;&#x5219;&#x8FD4;&#x56DE;&#x7A7A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x8FD4;&#x56DE;&#x503C;</p>
<p>&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x670D;&#x52A1;&#x63D0;&#x4F9B;&#x5546;&#x7684;&#x4EE3;&#x53F7;&#x3002;</p>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.share.getProvider();
</code></pre>
<h4 id=""> </h4>
<h4 id="unishareshareobject">uni.share.share(OBJECT)</h4>
<p>&#x5206;&#x4EAB;&#x5185;&#x5BB9;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">shareType</td>
<td style="text-align:left">Int</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7C7B;&#x578B;&#x3002;&#x9ED8;&#x8BA4;&#x56FE;&#x6587;0&#xFF0C;&#x7EAF;&#x6587;&#x5B57;1&#xFF0C;&#x7EAF;&#x56FE;&#x7247;2&#xFF0C;&#x82F1;&#x6587;3&#xFF0C;&#x89C6;&#x9891;4&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">title</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7C7B;&#x578B;0,1,3,4&#x5FC5;&#x987B;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7684;&#x6807;&#x9898;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">summary</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7684;&#x6458;&#x8981;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">targetUrl</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7C7B;&#x578B;0,3,4&#x5FC5;&#x987B;</td>
<td style="text-align:left">&#x70B9;&#x51FB;&#x540E;&#x7684;&#x8DF3;&#x8F6C;URL&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">imagePath</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7C7B;&#x578B;2,3,4&#x5FC5;&#x987B;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x56FE;&#x7247;/&#x7F29;&#x7565;&#x56FE;&#x7684;&#x672C;&#x5730;&#x5730;&#x5740;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">mediaUrl</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7C7B;&#x578B;3,4&#x5FC5;&#x987B;</td>
<td style="text-align:left">&#x5206;&#x4EAB;&#x7684;&#x97F3;&#x4E50;/&#x89C6;&#x9891;&#x6570;&#x636E;URL&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">success</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x6210;&#x529F;&#x56DE;&#x8C03;&#xFF08;&#x6682;&#x4E0D;&#x652F;&#x6301;&#xFF09;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">fail</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5931;&#x8D25;&#x56DE;&#x8C03;</td>
</tr>
<tr>
<td style="text-align:left">cancel</td>
<td style="text-align:left">Function</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x53D6;&#x6D88;&#x56DE;&#x8C03;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.share.share({
  shareType: <span class="hljs-number">0</span>,
  title: <span class="hljs-string">&quot;&#x6211;&#x662F;&#x6807;&#x9898;&quot;</span>,
  summary: <span class="hljs-string">&quot;&#x6211;&#x662F;&#x6458;&#x8981;&quot;</span>,
  imagePath: <span class="hljs-string">&quot;xxx/xxx/xxx/share.jpg&quot;</span>,
  targetUrl: <span class="hljs-string">&quot;http://www.example.com&quot;</span>,
  success: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">data</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling success&quot;</span>);
  },
  fail: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">data, code</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;handling fail, code=&quot;</span> + code);
  }
});
</code></pre>
<h4 id="&#x63A5;&#x5165;&#x8BF4;&#x660E;">&#x63A5;&#x5165;&#x8BF4;&#x660E;</h4>
<ol>
<li>&#x53C2;&#x8003;&#x7B2C;&#x4E09;&#x65B9;&#x5E73;&#x53F0;&#x6587;&#x6863;&#x8FDB;&#x884C;&#x63A5;&#x5165;&#xFF08;&#x5FAE;&#x4FE1;&#x5F00;&#x653E;&#x5E73;&#x53F0;/QQ&#x5F00;&#x653E;&#x5E73;&#x53F0;/&#x5FAE;&#x535A;&#x5F00;&#x653E;&#x5E73;&#x53F0;&#xFF09;&#x3002;</li>
<li>&#x5728;&#x7B2C;&#x4E09;&#x65B9;&#x5E73;&#x53F0;&#x540E;&#x53F0;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x65B0;&#x7684;app&#xFF0C;&#x8BE5;app&#x5305;&#x540D;&#x9700;&#x8981;&#x4E0E;manifest.json&#x4E2D;&#x7684;package&#x4E00;&#x81F4;&#x3002;</li>
<li>&#x5C06;app&#x7B7E;&#x540D;&#xFF08;&#x7B7E;&#x540D;&#x7684;&#x503C;&#x83B7;&#x53D6;&#xFF1A;&#x751F;&#x6210;&#x4E00;&#x4E2A;apk&#x4F7F;&#x7528;&#x7B2C;&#x4E09;&#x65B9;&#x540E;&#x53F0;&#x6CE8;&#x518C;&#x7684;&#x7B7E;&#x540D;&#x7B7E;&#x540D;apk&#xFF0C;&#x5728;&#x5B89;&#x88C5;apk&#x540E;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x5DE5;&#x5177;&#x83B7;&#x53D6;&#xFF09;&#x7684;&#x503C;&#x548C;&#x5404;&#x4E2A;&#x5E73;&#x53F0;&#x83B7;&#x53D6;&#x7684;&#x5E94;&#x7528;ID&#xFF0C;&#x586B;&#x5728;manifest.json&#x5206;&#x4EAB;&#x63A5;&#x53E3;&#x58F0;&#x660E;&#x7684;appSign&#x548C;&#x5BF9;&#x5E94;&#x7684;xxKey&#x5B57;&#x6BB5;&#x4E2D;&#xFF0C;&#x5982;&#x4E0A;&#x6587;</li>
<li>&#x652F;&#x6301;&#x624B;Q&#x3001;&#x5FAE;&#x4FE1;&#x3001;&#x5FAE;&#x535A;&#x5206;&#x4EAB;&#xFF0C;&#x6682;&#x65F6;&#x65E0;&#x6CD5;&#x83B7;&#x53D6;&#x5206;&#x4EAB;&#x7ED3;&#x679C;&#x3002;</li>
<li>&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x56FE;&#x6587;&#x5206;&#x4EAB;&#x7C7B;&#x578B;&#xFF0C;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x4E2A;&#x522B;&#x5E73;&#x53F0;&#x65E0;&#x6CD5;&#x652F;&#x6301;,&#x5C06;&#x4F7F;&#x7528;&#x56FE;&#x6587;&#x7C7B;&#x578B;&#x5206;&#x4EAB;&#x3002;</li>
<li>&#x5206;&#x4EAB;&#x56FE;&#x7247;&#x4EC5;&#x652F;&#x6301;&#x672C;&#x5730;&#x56FE;&#x7247;&#x3002;</li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="media.html" class="navigation navigation-prev " aria-label="Previous page: 图形图像">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="pay.html" class="navigation navigation-next " aria-label="Next page: 支付">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"分享","level":"1.5.8","depth":2,"next":{"title":"支付","level":"1.5.9","depth":2,"path":"api/pay.md","ref":"api/pay.md","articles":[]},"previous":{"title":"图形图像","level":"1.5.7","depth":2,"path":"api/media.md","ref":"api/media.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"api/share.md","mtime":"2018-04-04T08:21:28.912Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-04T08:24:24.953Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

